#pragma once

#include "funpl.h"

namespace funpl
{

namespace ast
{

/// Operator IDs.
namespace operator_id
{
	/// Enumeration.
	enum t
	{
		none,

		on,

		member,
		member_overload,

		evaluate,
		index,

		post_increment,
		post_decrement,

		dereference,
		address,
		move,

		cast,

		minus,
		plus,
		not,

		pre_increment,
		pre_decrement,

		mul,
		div,
		mod,

		add,
		sub,

		less,
		greater,
		less_equal,
		greater_equal,

		equal,
		not_equal,
		
		and,
		or,
		xor,

		logical_and,
		logical_or,

		assign,

		mul_assign,
		div_assign,
		mod_assign,

		add_assign,
		sub_assign,

		and_assign,
		or_assign,
		xor_assign
	};
}

/// Operator information.
struct operator_desc
{
	operator_id::t id;
	
	int precedence;

	bool unary;
	bool right_associative;
	bool postfix;

	/// Constructor.
	operator_desc(operator_id::t id, int precedence, bool unary = false, bool right_associative = false, bool postfix = false)
		: id(id),
		precedence(precedence),
		unary(unary),
		right_associative(right_associative),
		postfix(postfix) { }
};

/// Gets information on the given operator.
operator_desc operator_info(operator_id::t id);

} // namespace

} // namespace